<script setup lang="ts">
import { ref } from 'vue'
import { useI18n } from 'vue-i18n'
// import { ACane } from '@SvgIcon-park/vue'
const { t, locale } = useI18n()
console.log('t()', t('homeTitle'))
// console.log(i18n.global.t('homeTitle'), '在ts中使用i8n')

defineProps({
  msg: {
    type: String,
    required: true,
    default: 'Hello Vue 3 + Vite'
  }
})
//region关于一个测试的
// 测试
const test = () => {
  console.log('count', count)
}
//endregion

/**
 * @description 切换语言
 * @param lang 要切换的语言
 * @example
 * import { useI18n } from 'vue-i18n'
 * const {locale}=useI18n()
 * locale.value = 'en-US'
 */
const changeLanguage = (lang: string) => {
  locale.value = lang
}

const count = ref(0)
</script>

<template>
  <ACane />
  <h1>
    {{ msg }}
  </h1>
  <button @click="test">test</button>
  title:{{ $t('title') }}
  <button @click="changeLanguage('en-US')">change</button>
  <p>{{ count }}</p>
  <h1>zjj-dev</h1>
</template>
